var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn) {
	conn.createChannel(function(err, ch) {
		var ex = 'logs'; // exchange
		var msg = 'hello world';
		ch.assertExchange(ex, 'fanout', {
			durable: false
		});

		// send to exchange
		ch.publish(ex, '', new Buffer(msg));
		console.log(" [x] Sent %s", msg);

		// close
		setTimeout(function() {
			conn.close();
			process.exit(0)
		}, 500);
	});
});